Skip to content

feat: add Python SDK (pip install fff-search)#466

Open
YounesFil wants to merge 1 commit into
dmtrKovalenko:mainfrom
YounesFil:feat/python-sdk
Open

feat: add Python SDK (pip install fff-search)#466
YounesFil wants to merge 1 commit into
dmtrKovalenko:mainfrom
YounesFil:feat/python-sdk

Conversation

@YounesFil
Copy link
Copy Markdown

The README mentions Python via ctypes for binding the C lib but there's no Python package. Made one.

crates/fff-py is a small PyO3 crate that wraps fff-search directly. Installs as pip install fff-search. The API mirrors the Node SDK so it should look familiar:

from fff_search import FileFinder

with FileFinder.create(base_path=".", ai_mode=True) as f:
    f.wait_for_scan(timeout_ms=10_000)
    files = f.file_search("incognito profile", page_size=20)
    hits = f.grep("GetOffTheRecordProfile", classify_definitions=True)

In the PR:

  • crates/fff-py/: the new crate
  • python/fff_search/: Python facade with type stubs
  • tests/: 20 pytest tests covering search, grep, lifecycle, pagination, query history
  • .github/workflows/python-wheels.yml: builds wheels for linux/musllinux/macos/windows on tag, smoke tests them, publishes to PyPI

Using abi3-py39 so one wheel per platform handles Python 3.9 through 3.13.

Tested locally on Windows. cargo check is clean, maturin develop builds, all 20 pytest tests pass.

Couple things before merge:

  1. Went with PyO3 because it gives real typed Python objects (FileItem, GrepMatch etc) instead of forcing users to deal with raw ctypes. If you'd rather match fff-node and use ctypes over libfff_c, I can rewrite it.
  2. Named the package fff-search to match the Rust crate. If you want something different, or want me to grab fff on PyPI too, lmk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant